﻿using ZilLion.Service.Core.DapperWrapper;
using ZilLion.Service.Crm.ModelBase.EntityBase.Config;
using ZilLion.Service.Crm.Unities.Config;

namespace ZilLion.Service.WebInfrastructure.Base
{
    public class GloabConfigHandler : Respository<ConfigItem>, IGloabConfigHandler
    {
        public GloabConfigHandler(IDbContext Context) : base(Context)
        {
        }
        public ConfigGroup GetConfigItem(string jappid)
        {
            ConfigGroup item=new ConfigGroup();
            item.jappid = jappid;
            item.ConfigItems= this.GetList("select * from xtwxappidjoininfo where jappid=@jappid and (jisforbid=0 or jisforbid=2)", new { jappid });
            item.logsn = this.GetDataByScalar<int>("select MAX(logsn) from xtdatalogcrm where logtable='xtwxappidjoininfo'").GetValueOrDefault();
            return item;
        }

        public int CheckConfigItems()
        {
            int logsnv2 = this.GetDataByScalar<int>("select MAX(logsn) from xtdatalogcrm where logtable='xtwxappidjoininfo'").GetValueOrDefault();
            return logsnv2;
        }
    }
}
